from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship

from orm_learning.advanced_orm_learning.model import Base


class Permissions(Base):
    __tablename__ = 'permissions'

    id = Column(Integer, primary_key=True)
    name = Column(String, nullable=False, unique=True)

    users = relationship('Users', secondary='user_permissions', back_populates='permissions')
